import { defineConfig } from "vite";
import terserPlugin from "@rollup/plugin-terser";
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [],
  build: {
    rollupOptions: {
      plugins: [
        terserPlugin({
          compress: {
            //去掉console和debug对于terser的编译模式
            drop_console: true,
            drop_debugger: true,
          },
          format: {
            comments: false,
          },
        }),
      ],
    },
    minify: `terser`, // boolean | 'terser' | 'esbuild'
    sourcemap: false,
    cssCodeSplit: true,
    lib: {
      entry: "./src/index.ts",
      name: "index",
      fileName: "index",
      formats: ["es", "cjs", "umd", "iife"],
    },
  },
});
